//
// Created by LiuYou on 2021/12/9.
//

#include <iostream>
#include <cstring>
#include <sys/stat.h>


int main(int argc, char** argv) {
    {
        std::cout << "argc = " << argc << std::endl;
        std::cout << "argv = " << argv << std::endl;
        std::cout << "*argv = " << *argv << std::endl;
    }

    if (argc < 2) {
        fprintf( stderr, "用法: %s filename", basename( *argv ));
        return 1;
    }

    struct stat fileStatus;
    int ret = stat( argv[1], &fileStatus );
    if (ret < 0) {
        perror( "stat(): " );
        return 1;
    }

    std::cout << "fileStatus.st_size = " << fileStatus.st_size << std::endl;


    return 0;
}
